package com.orphan.supplier.po;

import lombok.Data;

import java.io.Serializable;

@Data
public class ListInfo implements Comparable<ListInfo>, Serializable {
    //供货单编号
    private String goodsInId;
    //商品名
    private String goodsName;
    //商品类型
    private String goodsType;
    //商品规格
    private String goodsSize;
    //商品价格
    private String goodsPrice;
    //供货时间
    private String goodsInTime;
    //商品数量
    private Integer goodsInNum;
    //供应商
    private String goodsSupplier;

    public ListInfo(DeliveryInfo deliveryInfo) {
        this.goodsName = deliveryInfo.getTender().getGoods().getName();
        this.goodsInId = deliveryInfo.getNumber();
        this.goodsType = deliveryInfo.getTender().getGoods().getName();
        this.goodsType = deliveryInfo.getTender().getGoods().getType();
        this.goodsSize = deliveryInfo.getTender().getGoods().getSpec();
        this.goodsPrice = String.valueOf(deliveryInfo.getTender().getPrice());
        this.goodsInTime = String.valueOf(deliveryInfo.getDeliveryTime());
        this.goodsInNum = deliveryInfo.getDeliveryAmount();
        this.goodsSupplier = deliveryInfo.getTender().getSupplier().getUsername();
    }

    @Override
    public int compareTo(ListInfo listInfo) {
        if (this.goodsInId.equals(listInfo.goodsInId)){
            return 0;
        }
        else return 1;
    }
}
